/**
 * 
 */
package org.atf.utils;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;


public class DBManager {
	public static String ATF_CONFIG_JNDI="jdbc/atfdb";
	
	
	 private static DataSource atfConfigdataSource;
	 
	 static {
	        try {
	        	atfConfigdataSource =(DataSource) new InitialContext().lookup("java:comp/env/"+ATF_CONFIG_JNDI);
	        } catch (NamingException e) {
				e.printStackTrace();
			} 
	    }

	
	public static Connection getATFConfigConnection(){
		Connection con= null;
		try {
			con= atfConfigdataSource.getConnection();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return con;
	}
	public static DataSource getATFConfigDataSource(){
		
		return atfConfigdataSource;
	}
}
